package com.iqiyi.pps.epg.core.model.sginal;

import com.iqiyi.pps.epg.api.model.web.sginal.TServerCluster;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by yanchao_sx on 2018/4/2.
 */

@Entity
@Table(name = "server_cluster")
@Cache(usage = CacheConcurrencyStrategy.NONE)
public class ServerCluster {
    private  int id;
    private String name;
    private String idc;
    private int status;
    private Timestamp addTime;
    private String user;
    private String including;
    private int serverNum;

    public static final int UN_ASSIGNED=-1;

    public TServerCluster convertThriftModel() {
        TServerCluster serverCluster = new TServerCluster();

        serverCluster.setId(this.id);
        serverCluster.setName(this.name);
        serverCluster.setStatus(this.status);
        serverCluster.setAddTime(this.addTime.toString());
        serverCluster.setUser(this.user);
        serverCluster.setIdc(this.idc);
        serverCluster.setIncluding(this.including);
        serverCluster.setServerNum(this.serverNum);

        return serverCluster;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name="name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name="idc")
    public String getIdc() {
        return idc;
    }

    public void setIdc(String idc) {
        this.idc = idc;
    }

    @Column(name="status")
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Column(name="add_time")
    public Timestamp getAddTime() {
        return addTime;
    }


    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    @Column(name="user")
    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    @Transient
    public String getIncluding() {
        return including;
    }

    public void setIncluding(String including) {
        this.including = including;
    }

    @Transient
    public int getServerNum() {
        return serverNum;
    }

    public void setServerNum(int serverNum) {
        this.serverNum = serverNum;
    }
}
